home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / 3d_hyper / 3d_hyper.dcr / Scripts_41_MeshGeneration.ls < prev    next >
Encoding:
Text File  |  2011-06-09  |  3.8 KB  |  142 lines

  1. global gWorld, gCar, gCamera, gCarModel, gCarInfo, gTransFormat, gSolidFormat, gTargetPoints, gHaveCPU, gSparkLocs, gSparkCount, gSparkSystems, gTimeStep, gHaveSound, gFinished, gCollDetails, gLastTrackCollision, gLastCarCollision, gCarAttributes, gCurrentVel, gPowerupList, gRemovedPowerups, gCurrTrack, gTimeInfo, gNumLaps
  2.  
  3. on stopSounds
  4.   repeat with i = 1 to 8
  5.     sound(i).stop()
  6.     sound(i).volume = 255
  7.     sound(i).pan = 0
  8.   end repeat
  9. end
  10.  
  11. on chooseRenderer whichStyle
  12.   rs = getRendererServices()
  13.   AvailableList = rs.rendererDeviceList
  14.   if whichStyle = #NonDTS then
  15.     if getOne(AvailableList, #openGL) then
  16.       rs.renderer = #openGL
  17.     else
  18.       rs.renderer = #software
  19.     end if
  20.   else
  21.     if whichStyle = #DTS then
  22.       if getOne(AvailableList, #directX7_0) then
  23.         rs.renderer = #directX7_0
  24.       else
  25.         if getOne(AvailableList, #openGL) then
  26.           rs.renderer = #openGL
  27.         else
  28.           if getOne(AvailableList, #directX5_2) then
  29.             rs.renderer = #directX5_2
  30.           else
  31.             rs.renderer = #software
  32.           end if
  33.         end if
  34.       end if
  35.     else
  36.       put "Unknown which style for chooseRenderer" && whichStyle
  37.     end if
  38.   end if
  39. end
  40.  
  41. on initializeTrackGlobals
  42.   gWorld.resetWorld()
  43.   gFinished = 0
  44.   gCollDetails = []
  45.   gLastTrackCollision = 0
  46.   gLastCarCollision = 0
  47.   gSparkLocs = []
  48.   gSparkSystems = []
  49.   gSparkCount = 0
  50.   gPowerupList = []
  51.   gRemovedPowerups = []
  52.   gCurrentVel = vector(0, 0, 0)
  53.   gNumLaps = 2
  54. end
  55.  
  56. on initializeGlobals
  57.   gTimeInfo = [0, 0]
  58.   gWorld = member("3DWorld")
  59.   gCurrTrack = 0
  60.   gTimeStep = 0.0333
  61.   gCarAttributes = [:]
  62.   addProp(gCarAttributes, #speed, [#min: 1450.0, #max: 1600.0])
  63.   addProp(gCarAttributes, #brake, [#min: 0.0035, #max: 0.0065])
  64.   addProp(gCarAttributes, #acceleration, [#min: 0.0035, #max: 0.0065])
  65.   addProp(gCarAttributes, #turning, [#min: 525.0, #max: 1125.0])
  66.   texFormatList = getRendererServices().getHardwareInfo().supportedTextureRenderFormats
  67.   gSolidFormat = VOID
  68.   if getOne(texFormatList, #rgba5550) then
  69.     gSolidFormat = #rgba5550
  70.   else
  71.     if getOne(texFormatList, #rgba5650) then
  72.       gSolidFormat = #rgba5650
  73.     else
  74.       if getOne(texFormatList, #rgba8880) then
  75.         gSolidFormat = #rgba8880
  76.       else
  77.         put "No Solid Format available"
  78.       end if
  79.     end if
  80.   end if
  81.   gTransFormat = VOID
  82.   if getOne(texFormatList, #rgba8888) then
  83.     gTransFormat = #rgba8888
  84.   else
  85.     if getOne(texFormatList, #rgba4444) then
  86.       gTransFormat = #rgba4444
  87.     else
  88.       if getOne(texFormatList, #rgba5551) then
  89.         gTransFormat = #rgba5551
  90.       else
  91.         put "No Transparent format"
  92.       end if
  93.     end if
  94.   end if
  95.   if voidp(gSolidFormat) then
  96.     gSolidFormat = gTransFormat
  97.   end if
  98.   if voidp(gTransFormat) then
  99.     gTransFormat = gSolidFormat
  100.   end if
  101.   getRendererServices().textureRenderFormat = gSolidFormat
  102.   if the controlDown and (the runMode = "Author") then
  103.     gHaveCPU = 0
  104.   else
  105.     gHaveCPU = 1
  106.   end if
  107. end
  108.  
  109. on preloadModels
  110.   member("Building01").preload()
  111.   member("Building02").preload()
  112.   member("TrackTestBig").preload()
  113. end
  114.  
  115. on ResetCamera
  116.   global gTrailPlane, gTS
  117.   gCamera = gWorld.camera(1)
  118.   gCamera.yon = 5100
  119.   if (getRendererServices().renderer <> #directX5_2) and (getRendererServices().renderer <> #software) then
  120.     gCamera.fog.enabled = 1
  121.     gCamera.fog.far = 5000
  122.     gCamera.fog.near = 2000
  123.     gCamera.fog.color = rgb("#000033")
  124.     gCamera.fog.decayMode = #exponential2
  125.   end if
  126.   tp = gWorld.newModelResource("TrailPlaneResource", #plane)
  127.   tp.widthVertices = 2
  128.   tp.lengthVertices = 2
  129.   tp.width = 20
  130.   tp.length = 20
  131.   gTrailPlane = gWorld.newModel("TrailPlaneModel", tp)
  132.   gTrailPlane.transform.position = vector(0, 0, -1.5)
  133.   gTrailPlane.parent = gCamera
  134.   ps = gTrailPlane.shader
  135.   ps.blend = 13
  136.   ps.texture = VOID
  137.   ps.ambient = rgb(0, 0, 0)
  138.   ps.diffuse = rgb(0, 0, 0)
  139.   gTS = ps
  140.   gCamera.colorBuffer.clearAtRender = 1
  141. end
  142.